//
//  xinxilistTableViewCell.m
//  BAOASystem
//
//  Created by michael on 2018/3/6.
//  Copyright © 2018年 czd. All rights reserved.
//

#import "xinxilistTableViewCell.h"
#import "OALoginViewController.h"
#import "fajianxqViewController.h"
@implementation xinxilistTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
 
 _label = [[UILabel alloc]init];
    _label.frame = CGRectZero;
      [_label setFont:[UIFont systemFontOfSize:16]];
       [self.contentView addSubview:_label];

       _label1 = [[UILabel alloc]init];
    _label1.frame = CGRectZero;
    _label1.textColor = [UIColor colorWithHexString:@"a1a1a1"];
      [_label1 setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label1];
    
         _label2 = [[UILabel alloc]init];
    _label2.frame = CGRectZero;
    _label2.textColor = [UIColor colorWithHexString:@"a1a1a1"];
      [_label2 setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label2];
    
                _label3 = [[UILabel alloc]init];
    _label3.frame = CGRectZero;
    _label3.textColor = [UIColor colorWithHexString:@"a1a1a1"];
      [_label3 setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label3];
    
                 _label4 = [[UILabel alloc]init];
    _label4.frame = CGRectZero;
    _label4.textColor = [UIColor colorWithHexString:@"a1a1a1"];
      [_label4 setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label4];
    
          _label5 = [[UILabel alloc]init];
    _label5.frame = CGRectZero;
    _label5.textColor = [UIColor colorWithHexString:@"a1a1a1"];
      [_label5 setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label5];
    
     _label6 = [[UILabel alloc]init];
    _label6.frame = CGRectZero;
    _label6.textColor = [UIColor colorWithHexString:@"a1a1a1"];
      [_label6 setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label6];

    
            _label1xq = [[UILabel alloc]init];
    _label1xq.frame = CGRectZero;
    _label1xq.textColor = [UIColor colorWithHexString:@"484848"];
      [_label1xq setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label1xq];
    
         _label2xq = [[UILabel alloc]init];
    _label2xq.frame = CGRectZero;
    _label2xq.textColor = [UIColor colorWithHexString:@"484848"];
      [_label2xq setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label2xq];
    
                _label3xq = [[UILabel alloc]init];
    _label3xq.frame = CGRectZero;
    _label3xq.textColor = [UIColor colorWithHexString:@"484848"];
      [_label3xq setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label3xq];
    
                 _label4xq = [[UILabel alloc]init];
    _label4xq.frame = CGRectZero;
    _label4xq.numberOfLines = 0;
    _label4xq.textColor = [UIColor colorWithHexString:@"484848"];
      [_label4xq setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label4xq];
    
          _label5xq = [[UILabel alloc]init];
    _label5xq.frame = CGRectZero;
    _label5xq.textColor = [UIColor colorWithHexString:@"484848"];
      [_label5xq setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label5xq];
    
     _label6xq = [[UILabel alloc]init];
    _label6xq.frame = CGRectZero;
    _label6xq.textColor = [UIColor colorWithHexString:@"484848"];
      [_label6xq setFont:[UIFont systemFontOfSize:13]];
       [self.contentView addSubview:_label6xq];
    _button = [UIButton buttonWithType:UIButtonTypeCustom];
    [_button addTarget:self action:@selector(action) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_button];


}

return self;

}
- (void)layoutSubviews{

[super layoutSubviews];
 _label.frame = CGRectMake(10,0, kScreenWidth-20, 30);
   _label1.frame = CGRectMake(0, _label.bottom, 120, 20);
    _label2.frame = CGRectMake(0, _label1.bottom, 120, 20);
    _label3.frame = CGRectMake(0, _label2.bottom, 120, 20);
    _label4.frame = CGRectMake(0, _label3.bottom, 120, 20);
    _label5.frame = CGRectMake(0, _label4.bottom, 120, 20);
    _label6.frame = CGRectMake(0, _label5.bottom, 120, 20);
    
       _label1xq.frame = CGRectMake(_label1.right, _label.bottom, kScreenWidth-_label1.width, 20);
    _label2xq.frame = CGRectMake(_label1.right, _label1.bottom, kScreenWidth-_label1.width, 20);
    _label3xq.frame = CGRectMake(_label1.right, _label2.bottom, kScreenWidth-_label1.width, 20);
      _label4xq.frame = CGRectMake(_label1.right, _label3.bottom, kScreenWidth-_label1.width, 20);
    _label5xq.frame = CGRectMake(_label1.right, _label4xq.bottom, kScreenWidth-_label1.width, 20);
    _label6xq.frame = CGRectMake(_label1.right, _label5xq.bottom, kScreenWidth-_label1.width, 20);
    _button.frame = CGRectMake(10, _label6.bottom, 150, 20);
    [_button setImage:[UIImage imageNamed:@"我的-联系信"] forState:UIControlStateNormal];
    [_button setTitle:NSLocalizedString(@"发送信息", nil) forState:UIControlStateNormal];
    _button.titleLabel.font = [UIFont systemFontOfSize: 12.0];
      [_button layoutButtonWithEdgeInsetsStyle:MKButtonEdgeInsetsStyleLeft  imageTitleSpace:0];
      [_button setTitleColor:[UIColor colorWithHexString:@"0aa0f6"] forState:UIControlStateNormal];
      _label.text = _dic[@"title"];
      _label1.text = NSLocalizedString(@"采购信息-类型", nil);
      _label2.text = NSLocalizedString(@"采购信息-创建时间", nil);
      _label3.text = NSLocalizedString(@"采购信息-到期时间", nil);
      _label4.text = NSLocalizedString(@"采购信息-剩余天数", nil);
      _label5.text = NSLocalizedString(@"采购信息-企业名称", nil);
      _label6.text = NSLocalizedString(@"采购信息-所在地", nil);
NSDictionary * comdic = _dic;
_label1xq.text =comdic[@"type"];
_label2xq.text =comdic[@"createDate"];
_label3xq.text =[NSString stringWithFormat:@"%@",comdic[@"endDate"]];
_label4xq.text =[NSString stringWithFormat:@"%@",comdic[@"syday"]];
NSDictionary *prodic = _dic[@"dmdcompany"];
_label5xq.text =prodic[@"name"];
_label6xq.text =[NSString stringWithFormat:@"%@",prodic[@"areaId"]];
}
- (void)action{
   UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];


    if (![[[NSUserDefaults standardUserDefaults]objectForKey:@"autoLogin"]isEqualToString:@"Y"]&&![[DanLi sharedDanLi].stay isEqualToString:@"yes"]) {
      OALoginViewController * loginVC = [storyBoard instantiateViewControllerWithIdentifier:@"LoginVC"];
        UINavigationController * navVC = [[UINavigationController alloc]initWithRootViewController:loginVC];
        loginVC.navigationController.navigationBar.hidden = YES;
                 self.ViewController.view.window.rootViewController = navVC;

}else{
fajianxqViewController *vc = [[fajianxqViewController alloc]init];
vc.hidesBottomBarWhenPushed = YES;

//@property (strong, nonatomic)  NSString *toMemberCompanyId;
//@property (strong, nonatomic)  NSString *toMemberNameId;
//
//@property (strong, nonatomic)  NSString *productId;

        NSDictionary * dic = _dic;
//vc.productId = dic[@"id"];
vc.toMemberNameId = dic[@"userId"];

vc.toMemberCompanyId = dic[@"cpid"];
[self.ViewController.navigationController pushViewController:vc animated:YES];

}
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
